<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			function pow1(x, n) {
				var sum = 1
				for (var i = 0; i < n; i++) {
					sum *= x
				}
				return sum
			}

			function pow2(x, n) {
				if (n === 1) return x
				if (n !== 1) {
					return x * pow2(x, n - 1)
				}
			}

			console.log('2^3:', pow1(2, 3))
			console.log('2^3:', pow2(2, 3))
		</script>
	</body>
</html>
